package com.conditional.domain.v2;

/**
 * 员工类型超类
 *
 * @author: cong zhi
 * @createDate: 2022/5/6 10:13
 * @updateUser: cong zhi
 * @updateDate: 2022/5/6 10:13
 * @updateRemark: 修改内容
 * @version: v1.0
 */
public abstract class EmployeeType {


    abstract int getTypeCode();


    static final int ENGINEER = 0;

    static final int SALESMAN = 1;

    static final int MANAGER = 2;


    abstract double payAmount(Employee emp);

    /**
     * 由于需要Employee对象数据，所以需要将Employee对象作为参数传递给payAmount()。
     * 将所有分支移除，然后将payAmount() 函数声明为抽象函数
     * @param emp
     * @return
     */
    /*double payAmount(Employee emp) {
        switch (getTypeCode()) {
            case ENGINEER:
                return emp.getMonthlySalary();
            case SALESMAN:
                return emp.getMonthlySalary() + emp.getCommission();
            case MANAGER:
                return emp.getMonthlySalary() + emp.getBonus();
            default:
                throw new RuntimeException("Incorrect Employee");
        }

    }*/
}
